﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Srvtools;

public partial class WorkTime_WorkTime_YearHoliday_Days : System.Web.UI.UserControl
{
    private Srvtools.WebDataSet WMaster;
    private string _EmployeeId   ;

    public string EmployeeId
    {
        get
        {
           return _EmployeeId;
        }
        set
        {
            _EmployeeId = value;
          //  this.ViewState["WorkTime_YearHoliday_Days_EmployeeId"] = _EmployeeId;
        }
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
       
        if (!IsPostBack)
        {
           
            ReLoad();
           }
        
    }
       
   public void  ReLoad()
   {
       
       InitializeComponent();
       Master.DataSource = WMaster;
       if (_EmployeeId == null || _EmployeeId == "")
       {
           _EmployeeId = "0";
       }
       Master.SetWhere("WorkTime_YearHoliday.EmployeeId= " + _EmployeeId);
       wgvMaster.DataBind();

       object[] objParam = new object[1];
       objParam[0] = _EmployeeId;
       object[] myRet = CliUtils.CallMethod("SWorkTime", "GetSumDaysOfYearHoliday", objParam);
       if (myRet != null && (int)myRet[0] == 0)
       {
           Single m = (Single)myRet[1];
           Label1.Text = "工号-" + _EmployeeId + ": 总共可用的带薪假为 <span style='color:red; font-weight:bold;font-size:20px;'>" + m.ToString() + "</span> 天";

           Label1.NavigateUrl = "WorkTime_YearHoliday_Days.aspx?Eid=" + _EmployeeId + "&red=" + Server.UrlEncode(Request.Url.ToString());
       }
}

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WorkTime_WorkTime_YearHoliday_Days));
        this.WMaster = new Srvtools.WebDataSet();
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).BeginInit();
        // 
        // WMaster
        // 
        this.WMaster.Active = true;
        this.WMaster.AlwaysClose = false;
        this.WMaster.DeleteIncomplete = true;
        this.WMaster.Guid = null;
        this.WMaster.LastKeyValues = null;
        this.WMaster.PacketRecords = 100;
        this.WMaster.Position = -1;
        this.WMaster.RemoteName = "SWorkTime.View_WorkTime_YearHoliday_Days";
        this.WMaster.ServerModify = false;
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).EndInit();
        
    }
   
}
